﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

using EF.BLL.Base;
using EF.Util;

public partial class Menu : BasePage
{
    private MenuService menuBLL = new MenuService();

    protected void Page_Load(object sender, EventArgs e)
    {
        CheckSession();

        switch (Request["action"].ToString().ToLower())
        {
            case "menu":
                GetMenu();
                break;
            default:
                break;
        }

        Response.End();
    }

    private void GetMenu()
    {
        try
        {
            DataTable dt = menuBLL.GetMenu(Session["role"].ToString(), Session["lang"].ToString());

            Response.Write("[" + JsonHelp.ConvertToTreeJson(dt, "id", "FatherId", 0) + "]");
        }
        catch (Exception e)
        {
            Response.Write("{success:false}");
        }
    }
}
